<%@ Page PathInChannel="ajax/member/order_list{Ext}" RunAt="Execute" %>
<script language="c#" runat="server">
protected string Condition()
{
	Dictionary<string, string> user = Manager.User;
	StringBuilder condition = new StringBuilder(AliCMS.CourseModule.Alias.Order.IsCanceled + "=false and " + AliCMS.CourseModule.Alias.Order.IsArchived + "=false and " + AliCMS.CourseModule.Alias.Order.IsPayed + "=2 and " + AliCMS.CourseModule.Alias.Order.DistributerIsAgent + "=true and " + AliCMS.CourseModule.Alias.Order.DistributerID + "=" + user["ID"]);
	string and = " AND ";

	#region 关键字
	String keyword = Request.QueryString["Keyword"];
	if (!String.IsNullOrEmpty(keyword))
		condition.Append(and + "(" + AliCMS.CourseModule.Alias.Order.UserName + " LIKE '%" + keyword + "%' or " + AliCMS.CourseModule.Alias.Order.No + " LIKE '%" + keyword + "%')");
	#endregion
	
	return condition.ToString();
}
</script>
<ali:List Mark="Course" Object="Order" Page="PageNumber" PageSize="Convert.ToInt32(Request.QueryString['PageSize'])" Condition="Condition()">
	<ali:Record>
		<a href="<%=BuildUrl(null, "member/order_view", "ID=" + InnerID)%>">
			<h1>
				<label><i>NO：</i><%=No%></label>
				<span><%=UserNickname%></span>
			</h1>
			<dl>
				<dt><img src="<%=CourseThumbnail%>"></dt>
				<dd>
					<h3><%=CourseName%></h3>
					<p>
						<label>单价：</label>
						<span>
							<%If Convert.ToString(TimeUnit) == "MONTH"%>
								<b><%=Price%></b> 元/<%=Convert.ToInt32(TimeAmount) == 1 ? "" : Convert.ToString(TimeAmount)%>月
							<%ElseIf Convert.ToString(TimeUnit) == "SEASON"%>
								<b><%=Price%></b> 元/<%=Convert.ToInt32(TimeAmount) == 1 ? "" : Convert.ToString(TimeAmount)%>季
							<%ElseIf Convert.ToString(TimeUnit) == "HALF_YEAR"%>
								<b><%=Price%></b> 元/<%=Convert.ToInt32(TimeAmount) == 1 ? "" : Convert.ToString(TimeAmount)%>半年
							<%ElseIf Convert.ToString(TimeUnit) == "YEAR"%>
								<b><%=Price%></b> 元/<%=Convert.ToInt32(TimeAmount) == 1 ? "" : Convert.ToString(TimeAmount)%>年
							<%Else%>
								<b><%=Price%></b> 元
							<%EndIf%>
						</span>
					</p>
					<p><label>过期时间：</label><span><%If Convert.IsDBNull(ExpiredTime)%>永久<%ElseIf Convert.ToDateTime(ExpiredTime) < DateTime.Now%>已过期<%Else%><%=(Convert.ToDateTime(ExpiredTime) - DateTime.Now).Days%>天后过期<%EndIf%></span></p>
				</dd>
			</dl>
			<h2><span>总价：<em><%=Convert.ToDecimal(Sum).ToString("0.00")%></em></span><span>收入：<em><%=Convert.ToDecimal(AgentCommision).ToString("0.00")%></em></span><span><%=Convert.ToDateTime(CreateTime).ToString("yyyy-MM-dd")%></span></h2>
		</a>
	</ali:Record> 
</ali:List>